<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Show_page extends CI_Pagination
{

	public $CI;
	public $page = array();

	public function __construct()
	{
		parent::__construct();
        $this->CI =& get_instance();
		$this->CI->load->library('pagination');
	}

	public function _pages($total_rows, $base_url, $suffix, $cur, $limit, $uri_segment)
	{
		$page = array();

		$page['suffix'] = $suffix;
		$page['total_rows'] = $total_rows;
		$page['base_url'] = $base_url;
		$page['per_page'] = $limit;
		$page['use_page_numbers'] = TRUE;
		$page['display_pages'] = FALSE;
		$page['uri_segment'] = $uri_segment;
		$page['next_link'] = '';
		$page['next_tag_open'] = '<div id="next" class="next btn">';
		$page['next_tag_close'] = '</div>';
		$page['prev_link'] = '';
		$page['prev_tag_open'] = '<div id="prev" class="prev btn">';
		$page['prev_tag_close'] = '</div>';
		$page['first_tag_open'] = '<div class="hide">';
		$page['first_tag_close'] = '</div>';
		$page['last_tag_open'] = '<div class="hide">';
		$page['last_tag_close'] = '</div>';
		$this->CI->pagination->initialize($page);
		$page['display'] = $this->CI->pagination->create_links();
		$page['start'] = ($cur-1) * $limit + 1;
		$page['end'] = $page['start'] + $limit - 1;
		if (0 == $page['total_rows']) 
		{
			$page['start'] = 0;
		}
		if ($page['end'] > $page['total_rows'])
		{
			$page['end'] = $page['total_rows'];
		}

		return $page;
	}

}